package com.gavin.test;

import com.gavin.DBTrans;
import com.gavin.plugin.database.ExternalAtomException;
import com.gavin.plugin.database.IAtom;
import com.gavin.model.Model;
import com.gavin.model.Request;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author Yudao 王冬明（woyuwodao@gmail.com）
 * @version 1.0
 * @title Administrator
 * @date 2018/11/8 11:08
 * @package com.gavin.test
 */
public class Atom {
    static Logger logger= LoggerFactory.getLogger(Atom.class);
    public static void main(String[] args) {
        DBTrans.getInstance().config(TestTrans.loadConfigFromResource("templates/config.properties", "utf-8", TestTrans.class.getClassLoader())).start();
        Request request=Request.build("TemplatesService", "update").set("strUserName", "張三").set("lMoney", 2000L);

        Model model=new Model();
        DBTrans.tx(new IAtom(){

            @Override
            public boolean excueter() throws ExternalAtomException {
                logger.info(request.model().toJson());
                return false;
            }

            @Override
            public Request getRequest() {
                return request;
            }
        });
    }
}
